package com.ybcj.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 统一响应结果类封装
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Result {
    private Integer code; // 响应码 1 成功 0 失败
    private String msg; // 响应信息 信息
    Object data; // 实际返回数据

    public static Result success(Object data) {
        return new Result(1, "success", data);
    }

    public static Result success() {
        return new Result(1, "sucess", null);
    }

    public static Result error(String msg){
        return new Result(0,msg,null);
    }
}
